package cn.xbtop.queue;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.jms.Queue;
import java.util.Date;

/**
 * @author Mxb
 * @version 1.0
 * @date 2020/6/10 16:42
 */
@Component
public class QueueProducer {

    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    @Autowired
    private Queue queue;


    @SuppressWarnings("deprecation")
    public void produceMsg(){
        jmsMessagingTemplate.convertAndSend(queue,"message："+new Date().toLocaleString());
    }
}
